import 'package:flutter/material.dart';
import 'package:flutter_aggregate/model/plant/constants.dart';

class TitleAndPrice extends StatelessWidget {
  const TitleAndPrice({
    Key? key, 
    required this.title, 
    required this.country, 
    required this.price,
  }) : super(key: key);

  final String title, country;
  final int price;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: palntKDefaultPadding),
      child: Row(
        children: [
          RichText(
            text: TextSpan(
              children: [
                TextSpan(
                  text: '$title\n',
                  style: Theme.of(context).textTheme.headline4!.copyWith(
                    color: palntKTextColor,
                    fontWeight: FontWeight.bold
                  )
                ),
                TextSpan(
                  text: country,
                  style: const TextStyle(
                    color: palntKPrimaryColor,
                    fontSize: 20,
                    fontWeight: FontWeight.w300
                  )
                )
              ]
            )
          ),
          const Spacer(),
          Text(
            '\$$price',
            style: Theme.of(context)
            .textTheme
            .headline5!
            .copyWith(
              color: palntKPrimaryColor
            ),
          )
        ],
      ),
    );
  }
}

